setwd("/Users/John/Dropbox/JOP_Replication_Materials/Logs/") # Set working directory to save log file

# Start logging
sink("replication_log.txt", split = TRUE)

# Timestamp header
cat("Replication Log started at", Sys.time(), "\n\n")

# Run scripts for main paper in order

# Note: The "01_create_process_share.R" script draws on proprietary data not included with the
# replication materials. See README.txt and replication_log.txt for more information 
#setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/") 
#source("01_create_process_share.R", echo = TRUE)  

setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/") # Replace with relevant working directory
source("02_create_hhi.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/")
source("03_create_soe_share.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/")
source("04_create_final_dataset.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/")
source("05_create_total_isic.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/")
source("06_figure_1.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/")
source("07_figure_2.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/")
source("08_figure_3.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/")
source("09_table_1.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/")
source("10_figure_4.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/code/")
source("11_figure_5.R", echo = TRUE)

# Run scripts for appendices in order
setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code") # Replace with relevant directory
source("B1_create_table_1.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("B2_create_alt_strategic.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("B3_create_figure_3.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("B4_create_table_2.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("B5_create_table_3.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C1_create_rnd_only.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C2_create_figure_4.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C3_create_gp0911_only.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C4_create_figure_5.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C5_create_figure_6.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C6_create_figure_7.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C7_create_figure_8.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C8_create_or_only.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C9_create_figure_9.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C10_create_lcr_only.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C11_create_figure_10.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C12_create_gp_only.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C13_create_figure_11.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C14_create_figures_12_13.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C15_create_figure_14.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C16_create_figures_15_16.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("C17_create_figure_17.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("D1_create_table_4.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("E1_create_marketsize.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("E2_create_table_5.R", echo = TRUE)

setwd("/Users/John/Dropbox/JOP_Replication_Materials/appendix/code")
source("E3_create_table_6.R", echo = TRUE)

# Finish log
cat("\n=== Replication completed at", Sys.time(), "===\n")
sink()
